<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="ja" xml:lang="ja">
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<meta http-equiv="Content-Script-Type" content="text/javascript" />
		<meta http-equiv="Content-Style-Type" content="text/css" />
		<meta http-equiv="keywords" content="" />
		<meta http-equiv="description" content="" />
		<title>コントロールパネル</title>

		<link rel="stylesheet" href="./assets/styles/default.css" type="text/css" />
		<script src="assets/scripts/jquery-1.3.2.min.js" type="text/javascript"></script>
		<script src="assets/scripts/menu.js" type="text/javascript"></script>
		
		<script type="text/javascript">
		$(function() {

			// メッセージのフェード
			$('.message').fadeIn("slow");

			// 戻るボタン押下
			$('#btn_back').click(function(){
				document.fm.mode.value = 'back';
				document.fm.submit();
			});
		});
		</script>
	</head>
	<body id="">
{{ php }} include( MENU_FILE ); {{ /php }}
		<div id="header" class="clearfix"><div class="wrapper">
			<h1><a href="./">コントロールパネル</a></h1>
			<form id="form_logout" action="logout.php" method="post"><p>{{ $login.staff_name }} <input type="submit" id="button_logout" value="ログアウト" /></p></form>
		</div></div>

		<div id="container"><div class="wrapper">

			<h2>スタッフ管理</h2>

			<ul class="submenu clearfix">
				<li><a href="staff_index.php">スタッフ一覧</a></li>
				<li><span>スタッフ登録</span></li>
			</ul>


			<h3>{{ if $forms.staff_id =='' }}スタッフ登録{{ else }}スタッフ更新{{ /if }}</h3>

			<p class="message">{{ $message }}</p>
{{ if $phase == 'input' }}
			<form name="fm" action="staff_form.php" method="post">

				<table class="formTable">

					<tbody>
	{{ if $forms.staff_id != '' }}
						<tr>
							<th>登録日</th>
							<td>
								{{ $forms.r_date }}
							</td>
						</tr>
						<tr>
							<th>更新日</th>
							<td>
								{{ $forms.u_date }}
							</td>
						</tr>
						<tr>
							<th>ID</th>
							<td>
								{{ $forms.staff_id }}
							</td>
						</tr>
	{{ /if }}
						<tr>
							<th>※ログインID</th>
							<td>
								<input type="text" name="login_id" id="text_information" class="text" value="{{ $forms.login_id|escape }}" />
								{{ $err.login_id }}
							</td>
						</tr>

						<tr>
							<th>※パスワード</th>
							<td>
								<input type="password" name="login_pass" id="text_information" class="text" value="{{ $forms.login_pass|escape }}" />
								{{ $err.login_pass }}
							</td>
						</tr>

						<tr>
							<th>※スタッフ名</th>
							<td>
								<input type="text" name="staff_name" id="text_information" class="text" value="{{ $forms.staff_name|escape }}" />
								{{ $err.staff_name }}
							</td>
						</tr>

						<tr>
							<th>※メールアドレス</th>
							<td>
								<input type="text" name="email" id="text_information" class="text" value="{{ $forms.email|escape }}" />
								{{ $err.email }}
							</td>
						</tr>

						<tr>
							<th>状態</th>
							<td>
								<label><input type="checkbox" name="status" value="1"{{ if $forms.status == '1' }} checked{{ /if }} />ログイン不可</label>
							</td>
						</tr>

						<tr>
							<th>権限</th>
							<td>
								<ul>
{{ html_checkboxes name=auth options=$arr_auth selected=$forms.auth assign=chkTags }}
{{ section name=checkbox loop=$chkTags }}
<li>{{ $chkTags[checkbox] }}</li>
{{ /section }}
								</ul>
							</td>
						</tr>
					</tbody>
				</table>

				<p class="button">
					<button type="reset"><span>クリア</span></button>
					<button type="submit" class="submit"><span>確認</span></button>
				</p>
				<input type="hidden" name="staff_id" value="{{ $forms.staff_id }}" />
				<input type="hidden" name="mode" value="input" />
			</form>
{{ /if }}

{{ if $phase == 'confirm' }}
			<form name="fm" action="staff_form.php" method="post">
				<table class="formTable">

					<tbody>
	{{ if $forms.staff_id != '' }}
						<tr>
							<th>ID</th>
							<td>
								000001
							</td>
						</tr>
	{{ /if }}
						<tr>
							<th>※ログインID</th>
							<td>
								{{ $forms.login_id|escape }}<input type="hidden" name="login_id" value="{{ $forms.login_id|escape }}" />
							</td>
						</tr>

						<tr>
							<th>※パスワード</th>
							<td>
								********<input type="hidden" name="login_pass" value="{{ $forms.login_pass|escape }}" />
							</td>
						</tr>

						<tr>
							<th>※スタッフ名</th>
							<td>
								{{ $forms.staff_name }}<input type="hidden" name="staff_name" value="{{ $forms.staff_name|escape }}" />
							</td>
						</tr>

						<tr>
							<th>※メールアドレス</th>
							<td>
								{{ $forms.email }}<input type="hidden" name="email" value="{{ $forms.email|escape }}" />
							</td>
						</tr>

						<tr>
							<th>状態</th>
							<td>
								{{ if $forms.status == '1' }}ログイン不可{{ /if }}
								<input type="hidden" name="status" value="{{ $forms.status }}" />
							</td>
						</tr>

						<tr>
							<th>権限</th>
							<td>
<ul>
{{ foreach from=$forms.auth key=k item=v }}
<li>{{ $arr_auth[$v] }}</li><input type="hidden" name="auth[]" value="{{ $v }}" />
{{ /foreach }}
</ul>
							</td>
						</tr>
					</tbody>
				</table>

				<p class="button">
					<button type="button" id="btn_back"><span>戻る</span></button>
					<button type="submit" class="submit"><span>{{ if $forms.staff_id == '' }}登録{{ else }}更新{{ /if }}</span></button>
				</p>
				<input type="hidden" name="staff_id" value="{{ $forms.staff_id }}" />
				<input type="hidden" name="mode" value="confirm" />
			</form>
{{ /if }}



		</div></div>
		<address>Copyright (C) SHIFT Inc. / All rights reserved</address>
	</body>

</html>